<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="${genParam.packageName}.${genParam.moduleName}.dao.${className}Dao">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="${genParam.packageName}.${genParam.moduleName}.entity.${className}" id="${className?uncap_first}Map">
<#list tableFields as field>
        <#if field.pk?? && field.pk>
        <id property="${field.javaFieldName}" column="${field.name}"/>
        <#else>
        <result property="${field.javaFieldName}" column="${field.name}"/>
        </#if>
</#list>
    </resultMap>
<#--
<#if table.relationType != 'TREE'>
    <select id="selectList" resultType="${genParam.packageName}.${genParam.moduleName}.entity.vo.${className}Vo">
        SELECT ${table.tableName}.*
            <#if table.extendedFields?? && table.extendedFields?size > 0>
                <#list table.extendedFields as extendedField>
                    <#if extendedField.ref??>
                        ,${extendedField.ref.tableName}.${extendedField.name}
                    </#if>
                </#list>
            </#if>
        FROM ${table.tableName}
        <#if table.tableFields?? && table.tableFields?size > 0>
            <#list table.tableFields as tableField>
                <#if tableField.ref??>
                    LEFT JOIN ${tableField.ref.tableName} ON ${tableField.ref.tableName}.${tableField.ref.fieldName} = ${table.tableName}.${tableField.name}
                </#if>
            </#list>
        </#if>
        <where>
            <#if table.tableFields?? && table.tableFields?size > 0>
                <#list table.tableFields as tableField>
                    <#if tableField.filterType?? && tableField.filterType == 'EQ'>
                        <if test="${tableField.name} != null">
                            AND ${tableName}.tableField.name = #{${tableField.name}}
                        </if>
                    </#if>
                    <#if tableField.filterType?? && tableField.filterType == 'BETWEEN'>
                        <if test="${tableField.name}Start != null">
                            AND ${tableName}.tableField.name >= #{${tableField.name}Start}
                        </if>
                        <if test="${tableField.name}End != null">
                            AND ${tableName}.tableField.name <= #{${tableField.name}End}
                        </if>
                    </#if>
                    <#if tableField.filterType?? && tableField.filterType == 'LIKE'>
                        <if test="${tableField.name} != null">
                            AND ${tableName}.tableField.name LIKE CONCAT('%',#{${tableField.name}},'%')
                        </if>
                    </#if>
                </#list>
            </#if>
            <#if table.extendedFields?? && table.extendedFields?size > 0>
                <#list table.extendedFields as extendedField>
                    <#if extendedField.filterType?? && extendedField.filterType == 'EQ' && extendedField.ref??>
                        <if test="${extendedField.name} != null">
                            AND ${extendedField.ref.tableName}.${extendedField.name} = #{${extendedField.name}}
                        </if>
                    </#if>
                    <#if extendedField.filterType?? && extendedField.filterType == 'BETWEEN' && extendedField.ref??>
                        <if test="${extendedField.name}Start != null">
                            AND ${extendedField.ref.tableName}.${extendedField.name} >= #{${extendedField.name}Start}
                        </if>
                        <if test="${extendedField.name}Start != null">
                            AND ${extendedField.ref.tableName}.${extendedField.name} <= #{${extendedField.name}End}
                        </if>
                    </#if>
                    <#if extendedField.filterType?? && extendedField.filterType == 'LIKE' && extendedField.ref??>
                        <if test="${extendedField.name} != null">
                            AND ${extendedField.ref.tableName}.${extendedField.name} LIKE CONCAT('%',#{${extendedField.name}},'%')
                        </if>
                    </#if>
                </#list>
            </#if>
        </where>
        <#if tableFields?? && tableFields?size > 0>
            <#list tableFields as tableField>
                <#if tableField.pk>
                    ORDER BY ${tableName}.${tableField.name} DESC
                <#elseif tableField.sortable>
                    ,${tableName}.${tableField.name} DESC
                </#if>
            </#list>
        </#if>
        <#if extendedFields?? && extendedFields?size > 0>
            <#list extendedFields as extendedField>
                <#if extendedField.sortable && extendedField.ref??>
                    ,${extendedField.ref.tableName}.${extendedField.name} DESC
                </#if>
            </#list>
        </#if>
    </select>
</#if>
-->
</mapper>